package im.oen.gui.tools.data.connect;

import im.oen.boot.common.utils.Checker;
import im.oen.boot.common.utils.UUID;
import im.oen.gui.tools.support.mysql.Connection;

/**
 * @author Kevin.Xu
 */
public class MysqlConnectData extends AbsConnect {
    private String driver = "com.mysql.cj.jdbc.Driver";
    private String ip;
    private String port;
    private String user;
    private String pass;
    private String database;

    private Connection connection;

    public MysqlConnectData() {
        this.setId(UUID.uid());
    }

    public void init(String name, String ip, String port, String db, String user, String pass) {
        this.setName(Checker.isEmpty(name) ? ip : name);
        this.database = db;
        this.ip = ip;
        this.port = port;
        this.user = user;
        this.pass = pass;
        this.setId(UUID.uid());
    }

    public String getDriver() {
        return driver;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getDatabase() {
        return database;
    }

    public void setDatabase(String database) {
        this.database = database;
    }

    public Connection getConnection() {
        return connection;
    }

    public void setConnection(Connection connection) {
        this.connection = connection;
    }
}
